package JDBC1;
import java.sql.*;
public class Demo2 {
        public static void main(String[] args) throws SQLException, ClassNotFoundException {
            //Driver driver=new Driver();
            //DriverManager.registerDriver(driver);
            Class.forName("com.mysql.jdbc.Driver");
            Connection connection= DriverManager.getConnection("jdbc:mysql://localhost:3306/student","root","root");
            //System.out.println(connection);
            String sql="SELECT * FROM student";
            Statement statement= connection.createStatement();
            ResultSet set= statement.executeQuery(sql);
            System.out.println(set);

            while(set.next())
            {

                int id=set.getInt("id");
                String name=set.getString("name");
                int age=set.getInt("age");
                String gander=set.getString("gander");
                String address=set.getString("address");
                if(age==19&&address.equals("浙江温州"))
                    System.out.println("student :"+id+","+name+","+age+","+gander+","+address);
            }
            statement.close();
            connection.close();
        }
    }

